package org.example.chat.controller;

import org.example.chat.aop.annotation.AccessLimiter;
import org.example.chat.aop.annotation.Log;
import org.example.chat.api.CommonResult;
import org.example.chat.entity.SystemLog;
import org.example.chat.service.ISystemLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author cheva
 */
@RestController
@RequestMapping("/syslog")
public class SystemLogController extends BaseController {

    @Autowired
    private ISystemLogService systemLogService;

    @AccessLimiter(rate = 3, isLimitByClientIp = true)
    @Log
    @GetMapping("/getpage")
    public CommonResult<List<SystemLog>> getSystemLogByPage(Integer pageNo, Integer pageSize) {
        List<SystemLog> systemLogs = systemLogService.queryByPage(pageNo, pageSize);
        return CommonResult.success(systemLogs);
    }
}
